import {ModalForm, ProFormDigit, ProFormText} from '@ant-design/pro-components';


export interface FormValueType extends Partial<API.SshInfoEdit> {
    target?: string;
    template?: string;
    time?: string;
    frequency?: string;
}


export interface EditFormProps {
    onOpenChange: (flag?: boolean, formVals?: FormValueType) => void;
    onSubmit: (values: FormValueType) => Promise<void>;
    editModalVisible: boolean;
    values: Partial<API.SshInfoEdit>;
}


export default (props: EditFormProps) => {
    return (
        <ModalForm
            title="修改shell信息"
            open={props.editModalVisible}
            onOpenChange={props.onOpenChange}
            onFinish={props.onSubmit}
            initialValues={props.values}
        >
            <ProFormText
                width="md"
                name="id"
                label="Id"
                hidden={true}
                disabled={true}
            />
            <ProFormText
                width="md"
                name="name"
                label="服务器名"
            />
             <ProFormText
                width="md"
                name="username"
                label="服务账号"
            />
            <ProFormText
                name="password"
                width="md"
                label="服务器密码"
            />
            <ProFormDigit
                width="md"
                name="port"
                tooltip="常规默认都是22端口"
                label="ssh端口"
                initialValue={22}
            />
            <ProFormText
                name="url"
                width="md"
                label="服务器ip"
            />
            <ProFormText
                name="remark"
                width="md"
                label="备注"
            />
        </ModalForm>
    );
};
